# 语法：
# try:
# 可能出现错误的代码块
# except:
# 出错之后执行的代码块
# else:
# 没有出错的代码块
# finally:
# # 不管有没有出错都执行的代码块
# try:
#     # num=int(input("请输入一个数字："))
#     # print(2/num)
#     list1=[1,3.14,"tom"]
#     print(list1[10])
#     pass
# except Exception as msg:
#     print(msg)
#     pass
# else:
#     print("代码正常，没有问题")
#     pass
# finally:
#     print("finally语句块被执行")

# try嵌套
# try:
#     num=int(input("请输入一个数字"))
#     try:
#         print(5/num)
#         pass
#     except Exception as msg:
#         print("我是try内部的异常处理")
#         print(msg)
#         pass
#     else:
#         print("一切正常")
#         pass
#     finally:
#         print("代码执行完毕")
#     pass
# except Exception as msg:
#     print("我是最外层的异常处理")
#     print(msg)
#     异常传递
def a():
    print(1/0)
    pass
def b():
    a()
    pass
def c():
    try:
        b()
        pass
    except Exception as msg:
        print(msg)
    pass
c()




